<%@ page language="java" contentType="text/html;charset=utf-8"
	pageEncoding="utf-8"%>

<%@ include file="/core/taglibs2.jsp"%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ include file="/core/adminTopMeta.jsp"%>
<script type="text/javascript">
			 
		 
	function check(){
		 
		if ($("#loginName").val() == "") {
			alert("请输入用户名。");
			return false;
		}  
		
		if ($("#onePassword").val().length < 1) {
			alert("登录密码未填写");
			 
			return false;
		}
		if ($("#onePasswordRec").val() != $("#onePassword").val()) {
			alert("两次一级密码不一样");
			 
			return false;
		}
		if ($("#twoPassword").val().length < 1) {
			alert("安全密码未填写");
			 
			return false;
		}
		if ($("#twoPassword").val() != $("#twoPasswordRec").val()) {
			alert("两次安全密码不一样");
			return false;
		}
		
		if ($("#pwdAnswer").val() == "") {
			alert("请输入密保答案。");
			return false;
		}  
		return true;
	}
</script> 
<script type="text/javascript">
	 
	function recommendChange(){
		
		 
		var recommendLoginName=$("#recommendLoginName").val(); 		
		 
		$.getJSON("<%=basePath%>/admin/member/ajaxGetRecommendByName.shtml",{recommendLoginName: recommendLoginName},function(result){	 
			 
			//填入新值
			if(result.success==true){
				 
				$("#recommendPersonName").html("推荐人姓名:"+result.member.personName);
			}else{
				 
				$("#recommendPersonName").html("<b  style='color: red;'>推荐人不存在</b>");
			} 
		});
		
	}
	
	
	function fatherChange(){
		
		var fatherLoginName=$("#fatherLoginName").val(); 	
		 
		$.getJSON("<%=basePath%>/admin/member/ajaxGetFatherByName.shtml",{fatherLoginName: fatherLoginName},function(result){	 
			//填入新值
			if(result.success==true){
				
				$("#fatherPersonName").html(result.title);
			}else{
				 
				$("#fatherPersonName").html("<b  style='color: red;'>接点人不存在</b>");
			} 
			 
		});
	}
	
	function centerChange(){
		
		 
		var centerLoginName=$("#centerLoginName").val(); 		
		 
		$.getJSON("<%=basePath%>/admin/member/ajaxGetCenterByName.shtml",{centerLoginName: centerLoginName},function(result){	 
			 
			//填入新值
			if(result.success==true){
				
				$("#centerPersonName").html(result.title);
			}else{
				 
				$("#centerPersonName").html("<b  style='color: red;'>该代理商不是服务中心</b>");
			} 
		});
		
	}
	 
	function loginNameChange(){
		
		var loginName=$("#loginName").val(); 	
		 
		$.getJSON("<%=basePath%>/admin/member/ajaxGetMemberByName.shtml",{loginName: loginName},function(result){	 
			//填入新值
			if(result.success==true){
				
				$("#loginNamePersonName").html("<b  style='color: blue;'>账号名可以用</b>");
			}else{
				$("#loginNamePersonName").html("<b  style='color: red;'>账号名已经存在</b>");
			}
			 
			
			 
		});
		 
		
	}
</script>  
</head>

<body oncontextmenu="return false"><div class="loader"></div>
 										
	<div class="row">
		<div class="col-md-12">
			<div class="panel">
				<div class="panel-heading text-primary">
					<h3 class="panel-title">
						<i class="fa fa-male"></i> 注册代理商
						<span class="pull-right">
							<div class="btn-group code">
								<a href="#" class="dropdown-toggle" data-toggle="dropdown"
									title="Classes used"> 
								</a>
							</div> 
						</span>
					</h3>
				</div>

				<!-- /panel body -->
			</div>
		</div>

		<div class="col-md-12">
			<div class="panel panel-primary">
				<div class="panel-heading">
					<h3 class="panel-title  text-white" style="font-size: 17px;">
						注册代理商
					</h3>
				</div>
				<div class="panel-body">
					<form id="commitForm" name="commitForm"  method="post" action="admin/member/memberAdd.shtml" onsubmit="check()">
						<jodd:form scopes="request" beans="member">
						 
						<table class="table table-bordered table-hover table-striped display" id="example">

							<tbody>

								 
								<tr>
									<td style="width: 30%;text-align: right; vertical-align:middle;">
										代理商编号<span style="color: red">(*必填)</span>：
									</td>
									<td>
										<input type="text"  id="loginName" name="loginName"  onchange="loginNameChange()" class="form-control form-cascade-control"/>
										<span id="loginNamePersonName"></span> 
									</td>
								</tr>

								<tr>
									<td style="width: 30%;text-align: right; vertical-align:middle;">
										推荐人编号：
									</td>
									<td>
										<input type="text"  id="recommendLoginName" name="recommendLoginName"  onchange="recommendChange()" class="form-control form-cascade-control"/>
										<span id="recommendPersonName"></span>
									</td>
								</tr>


								<tr>
									<td style="text-align: right;vertical-align:middle;">
										登录密码<span style="color: red">(*必填)</span>：
									</td>
									<td  >
										<input type="password" id="onePassword" name="onePassword"   class="form-control form-cascade-control"/>

									</td>
								</tr>
								<tr >
									<td style="text-align: right;vertical-align:middle;">
										确认登录密码<span style="color: red">(*必填)</span>：
									</td>
									<td  >
										<input type="password" id="onePasswordRec"  name="onePasswordRec" class="form-control form-cascade-control"/>

									</td>
								</tr>
								<tr>
									<td style="text-align: right;vertical-align:middle;">安全密码<span style="color: red">(*必填)</span>：</td>
									<td >
										<input type="password" id="twoPassword" name="twoPassword" class="form-control form-cascade-control" /> </td>
								</tr>
								<tr >
									<td style="text-align: right;vertical-align:middle;">确认安全密码<span style="color: red">(*必填)</span>：</td>
									<td ><input type="password" id="twoPasswordRec" name="twoPasswordRec" class="form-control form-cascade-control"/> </td>
								</tr>

								<tr >
									<td style="text-align: right;vertical-align:middle;">姓名：</td>
									<td  >
										<input type="text"  id="personName" name="personName" class="form-control form-cascade-control"/>  
									</td>
									
								</tr>

								<tr>
									<td colspan="2">
										<div style="color: red;text-align:center;">
											<div style="color:red;text-align:center">
												${retMsg}
											</div>
										</div>
									</td>
								</tr>
								<tr>
									<td colspan="2" style="text-align: center;">
										<button type="submit" class="btn btn-success "> 提 交 </button>
										<button type="reset" class="btn btn-warning"> 重 置 </button>
									</td>
								</tr>

							</tbody>


						</table>
					</jodd:form>	 
					</form>
				</div>
			</div>
			<!-- / Info Panel -->

		</div>

		<!-- /col-md-12 -->
	</div>
	<!--代码高亮end-->


	
</body>
</html>